import { h } from 'vue';
import { NPopconfirm, NButton } from 'naive-ui';
import { BasicColumn } from '@/components/Table';
export interface ListData {
  id: string;
  name: string;
  avatar: string;
  address: string;
  beginTime: string;
  endTime: string;
  date: string;
  [key: string]: string;
}
export function columns(sendMail, showRolesModal, chooseUnSumit): BasicColumn<ListData>[] {
  return [
    {
      title: '店铺名称',
      key: 'shop_name',
    },
    {
      title: 'eBay订单号',
      key: 'eBay_order_number',
      render(row) {
        return h(
          'span',
          {
            size: 'small',
            text: true,
            onClick: () => sendMail(row),
          },
          { default: () => row.eBay_order_number }
        );
      },
    },
    {
      title: '出单时间',
      key: 'issue_time',
    },
    {
      title: '最晚发货时间',
      key: 'latest_delivery_time',
    },
    {
      title: '最晚到货时间',
      key: 'latest_arrival_time',
    },
    {
      title: '客户名字',
      key: 'customer_name',
    },
    {
      title: '客户电话',
      key: 'customer_phone',
    },

    {
      title: '客户地址1',
      key: 'customer_address1',
    },
    {
      title: '客户地址2',
      key: 'customer_address2',
    },
    {
      title: '城市',
      key: 'city',
    },
    {
      title: '州',
      key: 'state',
    },
    {
      title: '邮编',
      key: 'zip',
    },
    {
      title: '任务分配时间',
      key: 'distribution_time',
    },
    {
      title: '操作',
      key: 'options',
      render(row) {
        return h(
          NPopconfirm,
          {
            size: 'small',
            onPositiveClick: () => showRolesModal(row),
            onNegativeClick: () => chooseUnSumit(row),
            negativeText: '否',
            positiveText: '是',
          },
          {
            default: () => '是否完成这个任务',
            trigger: () =>
              h(
                'button',
                {
                  size: 'small',
                  type: 'text',
                },
                {
                  default: () => '提交任务',
                }
              ),
          }
        );
      },
    },
  ];
}
